Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SPARK-23808][SQL] Set default Spark session in test-only spark sessions. #20926

Closed
wants to merge 6 commits into from

Conversation

jose-torres
Copy link
Contributor

What changes were proposed in this pull request?

Set default Spark session in the TestSparkSession and TestHiveSparkSession constructors.

How was this patch tested?

new unit tests

@jose-torres
Copy link
Contributor Author

@gatorsmile @tdas @jerryshao

Copy link
Member

@gatorsmile gatorsmile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@SparkQA
Copy link

SparkQA commented Mar 28, 2018

Test build #88677 has finished for PR 20926 at commit ffa816e.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
  • class TestSparkSessionSuite extends SparkFunSuite

Copy link
Contributor

@jerryshao jerryshao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@SparkQA
Copy link

SparkQA commented Mar 29, 2018

Test build #88684 has finished for PR 20926 at commit 7be16a9.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Mar 29, 2018

Test build #88683 has finished for PR 20926 at commit d0988f7.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
  • class TestSparkSessionSuite extends SparkFunSuite with SharedSparkSession

@SparkQA
Copy link

SparkQA commented Mar 29, 2018

Test build #88688 has finished for PR 20926 at commit 851a5ef.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@@ -175,8 +175,6 @@ private[hive] class TestHiveSparkSession(
loadTestTables)
}

SparkSession.setDefaultSession(this)
Copy link
Member

@gatorsmile gatorsmile Mar 29, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where did we set this for TestHive?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many Hive tests both call SparkSession.getOrCreate() and create a TestHiveSparkSession. To be clear, this isn't an optimization - the tests do not pass unless I remove this line.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed offline, we will remove the TestHive* changes and replace with a TODO.

@SparkQA
Copy link

SparkQA commented Mar 30, 2018

Test build #88719 has finished for PR 20926 at commit d9c996f.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@gatorsmile
Copy link
Member

LGTM

Thanks! Merged to master/2.3.

asfgit pushed a commit that referenced this pull request Mar 30, 2018
…ons.

## What changes were proposed in this pull request?

Set default Spark session in the TestSparkSession and TestHiveSparkSession constructors.

## How was this patch tested?

new unit tests

Author: Jose Torres <[email protected]>

Closes #20926 from jose-torres/test3.

(cherry picked from commit b348901)
Signed-off-by: gatorsmile <[email protected]>
@asfgit asfgit closed this in b348901 Mar 30, 2018
ghost pushed a commit to dbtsai/spark that referenced this pull request Apr 4, 2018
## What changes were proposed in this pull request?

Currently, the active spark session is set inconsistently (e.g., in createDataFrame, prior to query execution). Many places in spark also incorrectly query active session when they should be calling activeSession.getOrElse(defaultSession) and so might get None even if a Spark session exists.

The semantics here can be cleaned up if we also set the active session when the default session is set.

Related: https://github.com/apache/spark/pull/20926/files

## How was this patch tested?

Unit test, existing test. Note that if apache#20926 merges first we should also update the tests there.

Author: Eric Liang <[email protected]>

Closes apache#20927 from ericl/active-session-cleanup.
ericl added a commit to ericl/spark that referenced this pull request Apr 4, 2018
## What changes were proposed in this pull request?

Currently, the active spark session is set inconsistently (e.g., in createDataFrame, prior to query execution). Many places in spark also incorrectly query active session when they should be calling activeSession.getOrElse(defaultSession) and so might get None even if a Spark session exists.

The semantics here can be cleaned up if we also set the active session when the default session is set.

Related: https://github.com/apache/spark/pull/20926/files

## How was this patch tested?

Unit test, existing test. Note that if apache#20926 merges first we should also update the tests there.

Author: Eric Liang <[email protected]>

Closes apache#20927 from ericl/active-session-cleanup.
robert3005 pushed a commit to palantir/spark that referenced this pull request Apr 4, 2018
## What changes were proposed in this pull request?

Currently, the active spark session is set inconsistently (e.g., in createDataFrame, prior to query execution). Many places in spark also incorrectly query active session when they should be calling activeSession.getOrElse(defaultSession) and so might get None even if a Spark session exists.

The semantics here can be cleaned up if we also set the active session when the default session is set.

Related: https://github.com/apache/spark/pull/20926/files

## How was this patch tested?

Unit test, existing test. Note that if apache#20926 merges first we should also update the tests there.

Author: Eric Liang <[email protected]>

Closes apache#20927 from ericl/active-session-cleanup.
mshtelma pushed a commit to mshtelma/spark that referenced this pull request Apr 5, 2018
…ons.

## What changes were proposed in this pull request?

Set default Spark session in the TestSparkSession and TestHiveSparkSession constructors.

## How was this patch tested?

new unit tests

Author: Jose Torres <[email protected]>

Closes apache#20926 from jose-torres/test3.
mshtelma pushed a commit to mshtelma/spark that referenced this pull request Apr 5, 2018
## What changes were proposed in this pull request?

Currently, the active spark session is set inconsistently (e.g., in createDataFrame, prior to query execution). Many places in spark also incorrectly query active session when they should be calling activeSession.getOrElse(defaultSession) and so might get None even if a Spark session exists.

The semantics here can be cleaned up if we also set the active session when the default session is set.

Related: https://github.com/apache/spark/pull/20926/files

## How was this patch tested?

Unit test, existing test. Note that if apache#20926 merges first we should also update the tests there.

Author: Eric Liang <[email protected]>

Closes apache#20927 from ericl/active-session-cleanup.
asfgit pushed a commit that referenced this pull request Apr 8, 2018
…OrCreate

This backports #20927 to branch-2.3

## What changes were proposed in this pull request?

Currently, the active spark session is set inconsistently (e.g., in createDataFrame, prior to query execution). Many places in spark also incorrectly query active session when they should be calling activeSession.getOrElse(defaultSession) and so might get None even if a Spark session exists.

The semantics here can be cleaned up if we also set the active session when the default session is set.

Related: https://github.com/apache/spark/pull/20926/files

## How was this patch tested?

Unit test, existing test. Note that if #20926 merges first we should also update the tests there.

Author: Eric Liang <[email protected]>

Closes #20971 from ericl/backport-23809.
peter-toth pushed a commit to peter-toth/spark that referenced this pull request Oct 6, 2018
…ons.

Set default Spark session in the TestSparkSession and TestHiveSparkSession constructors.

new unit tests

Author: Jose Torres <[email protected]>

Closes apache#20926 from jose-torres/test3.

(cherry picked from commit b348901)
Signed-off-by: gatorsmile <[email protected]>

Change-Id: I01d1880071ea682ff03ce4f5825cdc51f4433f0d
otterc pushed a commit to linkedin/spark that referenced this pull request Mar 22, 2023
Currently, the active spark session is set inconsistently (e.g., in createDataFrame, prior to query execution). Many places in spark also incorrectly query active session when they should be calling activeSession.getOrElse(defaultSession) and so might get None even if a Spark session exists.

The semantics here can be cleaned up if we also set the active session when the default session is set.

Related: https://github.com/apache/spark/pull/20926/files

Unit test, existing test. Note that if apache#20926 merges first we should also update the tests there.

Author: Eric Liang <[email protected]>

Closes apache#20927 from ericl/active-session-cleanup.

(cherry picked from commit 359375e)

NOTE: This cherry-pick includes only some of the original changes, because LIHADOOP-54684 already made some identical
changes as part of test resolution. This now ensures the entirety of the original SPARK-23809 code is backported.
Also note that when SPARK-23809 was originally backported to branch-2.3 in PR apache#20971, the new `active` API was _not_
included since new APIs shouldn't generally be added in patch releases. That new API is exactly what is needed,
so we backport directly from the original commit.

RB=2575134
BUG=BDP-6088
G=spark-reviewers
R=mmuralid,wyzhang,smahadik
A=mmuralid,wyzhang
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants